<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	int number = 1;
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'shoppingcar.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<script type="text/javascript">
function pay() {
location.href="<%=basePath%>customer/toPay";
	}
	</script>
	</head>

	<body>
		<div>
			点餐单列表
		</div>
		<div>
			<s:a href="reser/fontAction">返回继续点餐</s:a>
		</div>
		<table cellpadding="1" border="1">
			<tr>
				<th>
					条目序号
				</th>
				<th>
					菜肴名称
				</th>
				<th>
					菜肴所属餐馆
				</th>
				<th>
					菜肴单价
				</th>
				<th>
					菜肴数量
				</th>
				<th>
					小计
				</th>
				<th>
					操作
				</th>
			</tr>
			<s:iterator value="%{#session.foodCar.items}" id="foodItem">
				<tr>
					<td><%=number++%></td>
					<td>
						<s:property value="%{#foodItem.foodName}" />
					</td>
					<td>
						<s:property value="%{#foodItem.resName}" />
					</td>
					<td>
						<s:property value="%{#foodItem.foodPrice}" />
					</td>
					<td>
						<s:property value="%{#foodItem.amount}" />
					</td>
					<td>
						<s:property value="%{#foodItem.totalPrice}" />
					</td>
					<td>
						<s:a href="customer/removeCar?itemId=%{#foodItem.itemId}">
						删除
						</s:a>
					</td>
				</tr>

			</s:iterator>
		</table>
		<div>
			总价：
			<s:property value="%{#session.foodCar.totalPrice}" />
		</div>
		<input type="button" value="结账" onclick="pay()">
	</body>
</html>
